#include<bits/stdc++.h>

using namespace std;
using ll = long long;
#define endl '\n'

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    for (int a, b, c, d; cin >> a >> b >> c >> d;) {
        vector<int> v{a, b, c, d};
        sort(v.begin(), v.end());
        int best = INT_MIN;
        do {
            int cur = (v[0] * 100 + v[1] * 10 + v[2]) * v[3];
            best = max(cur, best);
        } while (next_permutation(v.begin(), v.end()));
        cout << best << endl;
    }
    return 0;
}